package safety.impl;

import agricultural.AgriculturalMachine;
import safety.SafetyEventType;
import safety.SafetyHandler;

public class FaultDetectionHandler extends SafetyHandler {
    @Override
    public void handleSafetyEvent(SafetyEventType eventType, AgriculturalMachine machine) {
        if (eventType == SafetyEventType.FAULT_DETECTED) {
            System.out.println("故障检测处理器: " + machine.getMachineId() + "检测到故障，启动故障诊断");
            System.out.println(machine.getMachineId() + "执行故障诊断: 检查引擎系统...");
            System.out.println(machine.getMachineId() + "故障代码: E102 - 传感器异常");
            System.out.println(machine.getMachineId() + "执行故障处理: 降低作业速度，准备返回维修站");
        } else if (nextHandler != null) {
            nextHandler.handleSafetyEvent(eventType, machine);
        }
    }
}    